package xdu.lz.stage1_basic.chapter1_threadsafe.threadSafe.tax;

public class TaxCalculatorMain {
	public static void main(String[] args) {
/*		TaxCalculator taxCalculator = new TaxCalculator(10000d,2000d){
			@Override
			protected double calcTax() {
				return getSalary()*0.1 + getBonus()*0.15;
			}
		};

		System.out.println(taxCalculator.calculate());*/


		TaxCalculator taxCalculator = new TaxCalculator(10000d,2000d);
		//如果计算方式发生变化，只需要改接口的实现类即可。维护成本低。向上面那样维护成本高。
		//策略设置模式思想
		CalculatorStrategy calculatorStrategy = new SimpleCalculatorStrategy();
		taxCalculator.setCalculatorStrategy(calculatorStrategy);
		double tax = taxCalculator.calculate();
		System.out.println(tax);
	}

}
